package com.nf.action;

import com.nf.dao.CategoryDao;
import com.nf.entity.Category;
import com.nf.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TestAction {

    @Autowired
    private CategoryService categoryService;

    @ResponseBody
    @RequestMapping("/hi")
    public Category kkk(){
        Category c =new Category();
        c.setId(1);
        c.setName("郭大老板");
        return c;
    }

    //返回10条记录
    @ResponseBody
    @RequestMapping("/getAllCategory")
    public List<Category> getCategoryList() {
        List<Category> categoryList = categoryService.getCategoryList();
        return categoryList;
    }
}
